#ifndef _QQCLIENT_H
#define _QQCLIENT_H

#include "qqdef.h"
#include "buddy.h"

//login process
enum LOGIN_PROCESS{
	P_INIT = 0,
	P_LOGGING,
	P_VERIFYING,
	P_LOGIN,
	P_ERROR,
	P_DENIED,
	P_WRONGPASS,
	P_BUSY
};

typedef struct server_item{
	char	ip[32];
	ushort	port;
}server_item;

typedef struct qqclient{
	uint		number;
	ushort		version;
	ushort		seqno;
	int			socket;
	char		password[64];
	uchar		md5_pass1[16];
	uchar		md5_pass2[16];
	uint		server_ip;
	ushort		server_port;
	uint		proxy_server_ip;
	ushort		proxy_server_port;
	uchar		proxy_established;
	uint		client_ip;
	ushort		client_port;
	uint		local_ip;
	ushort		local_port;
	uint		last_login_ip;
	uint		last_login_time;
	uint		login_time;
	uint		server_time;
	char		mode;
	char		has_camera;
	int			process;
	char		log_terminal;
	char		log_packet;
	_DUMMY_pthread_t	thread_keepalive;
	_DUMMY_qqpacketmgr	packetmgr;
	qqbuddy*	self;
	//buddy qun group
	_DUMMY_list		buddy_list;
	_DUMMY_list		qun_list;
	_DUMMY_list		group_list;
	uint		online_clock;
	char		verify_dir[PATH_LEN];
	ushort		level;
	ushort		active_days;
	ushort		upgrade_days;
	_DUMMY_loop		event_loop;
	_DUMMY_loop		msg_loop;
	_DUMMY_pthread_mutex_t	mutex_event;
	char		network;	//TCP or UDP
	char		login_finish;
	char		auto_accept;	//accept addbuddy requests
	char		auto_reply[AUTO_REPLY_LEN];
	int			http_sock;
//	union{
//		struct qqdata_2009	data;
//	};
//	int		keep_alive_counter;
}qqclient;

#endif
